package com.fy.module.repo.mapper;

import com.fy.module.repo.entity.Repo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 题库 Mapper 接口
 * </p>
 *
 * @author yang
 * @since 2023-03-18
 */
public interface RepoMapper extends BaseMapper<Repo> {
    @Update("update el_repo set radio_count=(SELECT count(*) FROM el_qu_repo WHERE el_qu_repo.repo_id=#{repoId} AND  el_qu_repo.qu_type=1 ),\n" +
            "multi_count=(SELECT count(*) FROM el_qu_repo WHERE el_qu_repo.repo_id=#{repoId} AND  el_qu_repo.qu_type=2),\n" +
            "judge_count=(SELECT count(*) FROM el_qu_repo WHERE el_qu_repo.repo_id=#{repoId} AND  el_qu_repo.qu_type=3),\n" +
            "jdt_count=(SELECT count(*) FROM el_qu_repo WHERE el_qu_repo.repo_id=#{repoId} AND  el_qu_repo.qu_type=4)\n" +
            "where id=#{repoId}")
    int updateRepoQUCount(String repoId);
}
